import React, {useContext} from 'react';
import context from "../context";
import {upUserName} from "../store/actionCreator";
function Child(props) {
    const {state,dispatch} = useContext(context)
    return (
        <div>
            <h3>Child</h3>
            <p onClick={()=>dispatch(upUserName("yanqi"))}>userName:{state.userName}</p>
            <p>age:{state.age}</p>
        </div>
    );
}

export default Child;